<?php

class Fields extends Core {
    
    function __construct() {
        
        parent::__construct();
        
        $this->load->model('modpage');
        
    }
    
    
    public function index($page = false) {
        
        if ($this->load->settings('uri')) {
            
            $page = $this->load->settings('uri');
        }
        
        $page = $this->modpage->get($page);
        
        if ($page->num_rows() == 0) {
            
            page_404();
        }
        
        $data['fields'] = $page->row_array();
        
        parent::render($data);
    }
    
    
    public function block($page = false) {
        
        $data = $this->modpage->get($page)->row_array();
            
        parent::render(html_entity_decode($data['pag_text']));
    }
}